//    Copyright (C) Kherty.  All rights reserved.
#region

using System.Globalization;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.TextFormatting;

#endregion

namespace OpenLS.Spreadsheet.UI.Internals
{
    internal class CellInheritedTextRunProperties : TextRunProperties
    {
        private readonly TextRunProperties _properties;
        private readonly Brush _foreground;
        private readonly Brush _background;

        public CellInheritedTextRunProperties(TextRunProperties properties, Brush foreground, Brush background)
        {
            _properties = properties;
            _foreground = foreground;
            _background = background;
        }

        public override Typeface Typeface
        {
            get { return _properties.Typeface; }
        }

        public override double FontRenderingEmSize
        {
            get { return _properties.FontRenderingEmSize; }
        }

        public override double FontHintingEmSize
        {
            get { return _properties.FontHintingEmSize; }
        }

        public override TextDecorationCollection TextDecorations
        {
            get { return _properties.TextDecorations; }
        }

        public override Brush ForegroundBrush
        {
            get { if (_foreground != null)
                return _foreground;
                return _properties.ForegroundBrush;
            }
        }

        public override Brush BackgroundBrush
        {
            get { if (_background != null)
                return _background;
                return _properties.BackgroundBrush;
            }
        }

        public override CultureInfo CultureInfo
        {
            get { return _properties.CultureInfo; }
        }

        public override TextEffectCollection TextEffects
        {
            get { return _properties.TextEffects; }
        }
    }
}